package com.miao.elm.controller;

import com.miao.elm.entity.OrderdetailetEntity;
import com.miao.elm.service.OrderdetailetService;
import com.miao.elm.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;


@RestController
@RequestMapping("OrderdetailetController")
public class OrderdetailetController {
    @Autowired
    private OrderdetailetService orderdetailetService;

    /**
     * 信息
     */
    @RequestMapping("/info/{odId}")
    public R info(@PathVariable("odId") Integer odId){
		OrderdetailetEntity orderdetailet = orderdetailetService.getById(odId);

        return R.ok().put("orderdetailet", orderdetailet);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody OrderdetailetEntity orderdetailet){
		orderdetailetService.save(orderdetailet);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody OrderdetailetEntity orderdetailet){
		orderdetailetService.updateById(orderdetailet);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] odIds){
		orderdetailetService.removeByIds(Arrays.asList(odIds));

        return R.ok();
    }

}
